"use strict";
const Constant = require("../basics/constant");
const BaseModel = require("../basics/mysql/mapper");

class HomeModel extends BaseModel {
  constructor(cloud) {
    super(cloud, "ticket");
  }

  /**
   * 获取实例
   * @param {*} cloud 
   */
  static getInstant(cloud) {
    return new HomeModel(cloud);
  }

  /**
   * 查询列表
   */
  async selectList() {
    const ex = this.createExample();
    ex.setOrder("id","desc");
    return await this.selectListByExample(ex);
  }

  /**
   * 查询单条
   * @param {*} code 
   */
  async selectOneByCode(code) {
    const ex = this.createExample();
    ex.criteria.andEqual("code", code);
    return await this.selectOneByExample(ex);
  }
}

module.exports = HomeModel;